home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak Vol E-12
/
(Vol E-12) May 21 2012.iso
/
Animations
/
dj
/
dj.swf
/
scripts
/
__Packages
/
mx
/
controls
/
streamingmedia
/
MiniPlayBar.as
< prev
next >
Wrap
Text File
|
2012-05-21
|
3KB
|
114 lines
class mx.controls.streamingmedia.MiniPlayBar extends MovieClip
{
function MiniPlayBar()
{
super();
this.init();
}
function init()
{
this._controller = this._parent;
this.draw();
}
function isVertical()
{
return !this._controller.__get__horizontal();
}
function getCompletionPercentage()
{
var _loc2_ = undefined;
if(this.isVertical())
{
_loc2_ = this.yToPercent(this._thumb._y);
}
else
{
_loc2_ = this.xToPercent(this._thumb._x);
}
return _loc2_;
}
function setCompletionPercentage(aPercentage)
{
aPercentage = Math.floor(aPercentage);
if(aPercentage < 1)
{
aPercentage = 1;
}
else if(aPercentage > 100)
{
aPercentage = 100;
}
if(this.isVertical())
{
var _loc3_ = this.percentToY(aPercentage);
this._thumb._y = this.getActualHeight() - _loc3_ - 1;
this._hilite._height = _loc3_ - 1;
this._hilite._y = this.getActualHeight() - _loc3_ - 2;
}
else
{
var _loc4_ = this.percentToX(aPercentage);
this._thumb._x = _loc4_;
this._hilite._width = _loc4_ - 1;
}
}
function getController()
{
return this._controller;
}
function draw(h)
{
if(this.isVertical())
{
this._y = 8;
if(h == null)
{
h = this.getHeight();
}
this._tray.setHeight(h);
}
else
{
var _loc3_ = this.getWidth();
this._x = 8;
this._tray.setWidth(this.getWidth());
}
this.setCompletionPercentage(this._controller.__get__playPercent());
}
function getWidth()
{
var _loc2_ = !this.isVertical() ? this._controller.__get__width() - 16 : 6;
return _loc2_;
}
function getHeight()
{
var _loc2_ = !this.isVertical() ? 6 : this._controller.__get__height() - 16;
return _loc2_;
}
function getActualHeight()
{
var _loc2_ = this._tray.getHeight();
return _loc2_;
}
function xToPercent(x)
{
var _loc2_ = 100 * x / (this.getWidth() - 2);
return _loc2_;
}
function percentToX(percent)
{
var _loc2_ = (this.getWidth() - 2) * (percent / 100);
return _loc2_;
}
function yToPercent(y)
{
var _loc2_ = 100 * (y - 1) / (this.getActualHeight() - 3);
return _loc2_;
}
function percentToY(percent)
{
var _loc2_ = (this.getActualHeight() - 3) * (percent / 100) + 1;
return _loc2_;
}
}